package com.example.utils;

/**
 * 基于ThreadLocal封装工具类，用户保存和获取当前登录用户id
 */
public class BaseContext {
    private static ThreadLocal<Long> threadLocal = new ThreadLocal<>();
    //用户保存方法
    public static void setById(Long id){
        threadLocal.set(id);
    }
    //用户获取方法
    public static Long getById(){
        Long aLong = threadLocal.get();
        return aLong;
    }
}
